package cz.myslivec.base1;

import javax.ejb.Stateless;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;

@Named
@Stateless
public class Bean1 {
	
	@PersistenceContext(type = PersistenceContextType.TRANSACTION, unitName = "main-unit")
	protected EntityManager entityManager;
    
	private String firstName;
	private String lastName;
	
	public void doSumit() {
		System.out.println("SUBMIT SUBMIT!!!!");
		System.out.println("");
		System.out.println("firstName: " + firstName);
		System.out.println("lastName: " + lastName);
		
		//------
		Member mb = new Member();
		mb.setFirstName(firstName);
		mb.setLastName(lastName);
		entityManager.persist(mb);
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
}

